<?php
//级别部分
class a_listService extends Service{
	//要加缓存
	public function __construct(){
		parent::__construct();
        
        $this->url_service=load_service('url',P_SVC);
        $this->url_service->set_module_id(11);
        
		$this->table_cate=table('category');
		$this->table=table('arc');
		$this->table_data=table('arc_data');
		$this->table_attrtag=table('attrtaglist');
		$this->table_wordtag=table('wordtaglist');
		$this->table_index_1=table('index_1');
		$this->table_index_2=table('index_2');
		
	}
	//取12个文章级别
	public function levels(){
		$d=array();
		//'static_rule_list_index'=>array('/html/{level_id}/index.html',ROOT.'html/{level_id}/index.html'),
		$query="select `id`,`name` from `{$this->table_cate}` order by `mysort` asc";
		$result=$this->m->query($query);
		while(false!==$row=$this->m->fetch_assoc($result)){
            list($row['linkurl'],)=$this->url_service->var_list_index($row['id'])->list_index();
			$d[]=$row;
		}
		return $d;
	}
	public function in_($level_id,$n=12){
		$query="select distinct `l`.`tag` from `{$this->table_attrtag}` `l` left join `{$this->table}` `a` on `l`.`arc_id`=`a`.`id` where 1 and `a`.`level_id`='{$level_id}' and `a`.`status`='1' order by `l`.`id` asc limit {$n}";
		$info=$this->m->mselect($query);
		return $info;
	}
	public function get_tagid($tag){
		$query="select `id` from `{$this->table_index_1}` where `tag`='{$tag}' limit 1";
		return $this->m->get_field($query);
	}
//	
}